﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;

namespace ARS.DataBase.Provider
{
    public abstract class IDbProvider
    {
        public abstract int ExecuteSql(string SQLString);
        public abstract DataSet Query(string SQLString);

        public bool Exists(string strSql)
        {
            object obj = GetSingle(strSql);
            int cmdresult;
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        public abstract bool ExistsTable(string tableName);
        public abstract bool ExistsColumn(string tableName,string columnName);
        //public bool ExistsTable(string tableName)
        //{
        //    return Exists(tableName);
        //}
        public abstract DbDataReader ExecuteReader(string strSQL);
        public abstract object GetSingle(string SQLString);
        public abstract object GetSingle<T>(string SQLString, params T[] cmdParms);



    }
}
